import React, {Component} from 'react';


class Jack extends Component {

  render() {
    return (
      <div>
        <h1>{this.props.msg}</h1>
        Jack
        <button onClick={this.props.changeMsg('No!!!')}>say</button>
      </div>
    );
  }

}

class Rose extends Component {
  render() {
    return (
      <div>
        <h1>{this.props.msg}</h1>
        肉丝
      </div>
    );
  }

}

class Brother extends Component {
  state = {
    msg: 'you jump i jump'
  }

  changeMsg = (msg) => () => {
    this.setState({
      msg,
    })
  }

  render() {
    return (
      <div>
        <Jack changeMsg={this.changeMsg} msg={this.state.msg}/>
        <hr/>
        <Rose msg={this.state.msg}/>
      </div>
    );
  }
}

export default Brother;
